import express from 'express';
import path from 'path';

const app = express();
const port = 3000;

// 设置静态文件目录
const __dirname = path.resolve();
app.use(express.static(__dirname));

// 添加根路径路由
app.get('/', (req, res) => {
  res.sendFile(path.join(__dirname, 'index.html'));
});

// 启动服务器
app.listen(port, () => {
  console.log(`贪吃蛇游戏服务器已启动，访问地址: http://localhost:${port}`);
});